﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'rolesFromUserDelete')
	BEGIN
		DROP  Procedure  rolesFromUserDelete
	END
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[rolesFromUserDelete] 
	-- Add the parameters for the stored procedure here
	@user_id INT
AS
BEGIN
	SET NOCOUNT ON;

	-- Insert statements for procedure here
	IF (EXISTS(	SELECT * 
					FROM lit_usuario
					WHERE lit_usuario_id = @user_id)) 
	BEGIN
		DELETE FROM lit_usuario_rol WHERE lit_usuario_id = @user_id;
		SELECT 1;
	END
	ELSE SELECT 0;
END
GO